package com.ddlx.test.binder.util;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.Toast;

public class Utils {

	private static Handler sMainHandler = new Handler(Looper.getMainLooper());
	public static void showToast( final Context context, final String str ) {
		Log.d("ddlx", "showToast:"+str);
		if ( Thread.currentThread() == Looper.getMainLooper().getThread() ) {
			Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
		} else {
			sMainHandler.post( new Runnable() {
				
				@Override
				public void run() {
					Toast.makeText(context, str, Toast.LENGTH_SHORT).show();
				}
			});
		}
	}
}
